'use strict';


import React, {Component} from 'react';

import {
    View,
    Image,
    ImageBackground,
    Dimensions,
    TouchableWithoutFeedback,
    StyleSheet,
    Text,
    TouchableOpacity,
    TextInput,
    ScrollView,
    TouchableHighlight,
    TouchableNativeFeedback,
    Switch,
    StatusBar,
} from 'react-native';

import ToastUtil from '../../../../core/utils/toast-util';
import {Loading, EasyLoading} from 'react-native-easy-loading';
import DatePicker from 'react-native-datepicker'
import CameraButton from '../../../../core/component/comp.button-camera';
import Color from '../../../../core/constant/color';
import Http from '../../../../core/utils/http';


import MessageItem from '../../../../core/component-biz/comp.message-item';

let winWidth = Dimensions.get('window').width;//屏幕宽度
let winHeight = Dimensions.get('window').height;//屏幕高度

class MessageMainScene extends React.Component {

    static navigationOptions = ({navigation, screenProps}) => ({
        title: "消息",
        headerTintColor: "white",
        headerStyle: {
            backgroundColor: Color.PRIMARY_COLOR,
            elevation: null
        },
    });

    constructor(props) {
        super(props);
        this.state = {}
    }

    componentDidMount() {
    }


    onPressMessageItem(item,index){
        const { navigate } = this.props.navigation;
        navigate('MessageScene',{title:item.title});
    }

    genMessageListUI() {
        const messageList = [
            {title: "官方客服", subTitle: "1000刚刚也浏览了你的个人主页", time: "刚刚"},
            {title: "动态通知", subTitle: "", time: "昨天19:30"},
            {title: "雅安达人", subTitle: "", time: "1小时前"},
        ];
        const messageUI = messageList.map((item, index) => {
            return (<MessageItem key={`message-list-item-${index}`} title={item.title} subTitle={item.subTitle} rightTitle={item.time} onPress={this.onPressMessageItem.bind(this,item,index)}/>)
        })
        return messageUI
    }

    render() {
        return (
            <ScrollView style={styles.body}>
                {this.genMessageListUI()}
            </ScrollView>
        )
    }
}

const styles = StyleSheet.create({
    body: {
        backgroundColor: '#FFF',
        height: winHeight,
        flex: 1,
    },

});

export default MessageMainScene;